/*OWmq6Ugo6jPE4W7xoi1UXr4Tp1/n/Vi+P1J4TZWCBleFqRbMKl/Fh/GX//kGX13Z*/
import { pageConfig } from '../const';
import ampub from 'ampub';
const { components } = ampub;
import fa from 'fa';

const { fa_components } = fa;
const { ReferLinkage } = fa_components;
const { referLinkageClear } = ReferLinkage;
const { searchAreaId, ListConfig } = pageConfig;

// 参照过滤业务单元
const { components: { assetOrgMultiRefFilter: { isMultiCorpRefHandler, renderCompleteEvent } } } = ampub;

/**
 * 查询区编辑后事件
 * @param {*} key 
 * @param {*} value 
 */
export default function afterEvent(key, value) {
	if (key == 'pk_org') {
		referLinkageClear.call(this, this.props, key, ListConfig);
	}
	if (key == 'pk_applyorg') {
		referLinkageClear.call(this, this.props, key, ListConfig);
	}

	// 主组织编辑后：主组织关联参照字段控制其业务单元是否显示
	if (key === 'pk_org') {
		renderCompleteEvent.call(this, this.props, searchAreaId, 'pk_org', orgAfterEvent.bind(this));
	}
}

/**
 * 主组织关联参照字段控制其业务单元是否显示
 * @param {*s} field 
 * @param {*} value 
 */
export function orgAfterEvent(field, value) {
	if (field === 'pk_org') {
		//获取账簿
		isMultiCorpRefHandler.call(this, this.props, value, searchAreaId, [
			// 经办人
			'pk_transactor'
		]);
	}
}

/*OWmq6Ugo6jPE4W7xoi1UXr4Tp1/n/Vi+P1J4TZWCBleFqRbMKl/Fh/GX//kGX13Z*/